# name : alpha bound of spending function
# key : alpha_bound
# contributor: Shuguang Sun
# --
alpha_bound <- function(alpha1, t, alpha = 0.025) {
  ret <- pnorm(
    gsDesign:::gsBound1(0, c(t, 1), c(-20, -20), c(alpha1, alpha - alpha1))$b[2],
    lower.tail = FALSE
  )

  invisible(ret)
}

alpha_bound_v <- Vectorize(alpha_bound,
  vectorize.args = c("alpha1", "t"),
  SIMPLIFY = TRUE, USE.NAMES = TRUE
)
